<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        function deepCopy(data){
            let n = JSON.stringify(data);
            let j = JSON.parse(n);
            return j;
        }
        let a = [1,2,4,5,6,[4,5]]
        console.log(deepCopy(a));
        a[5][0]=10;
        let b = {
            name:"哈哈哈",
            age:18,
            hobbies:["吃饭","睡觉"]
        }
        console.log(deepCopy(b));
        b.age = 20;
        b.hobbies[0]="打豆豆"
    </script>
</body>
</html>